home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 332_02 / windel.c < prev    next >
C/C++ Source or Header  |  1990-01-05  |  2KB  |  44 lines

  1. /****************************************************************/
  2. /* Delwin() routine of the PCcurses package.            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*                Bjorn Larsson (bl@infovox.se)    */
  10. /****************************************************************/
  11. /* 1.4:  Use of short wherever possible. Portability        */
  12. /*     improvements:                    900114    */
  13. /* 1.3:  MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  14. /* 1.2:     Max limits off by 1. Fixed thanks to S. Creps:    881002    */
  15. /* 1.0:     Release:                    870515    */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include <curspriv.h>
  20.  
  21. char _curses_windel_rcsid[] = "@(#)windel.c     v.1.4  - 900114";
  22.  
  23. /****************************************************************/
  24. /* Delwin() deallocates all data allocated by 'win'. If 'win'    */
  25. /* is a subwindow, it uses the original window's lines for sto-    */
  26. /* rage, and thus the line arrays are not deallocated.        */
  27. /****************************************************************/
  28.  
  29. void delwin(win)
  30.   WINDOW    *win;
  31.   {
  32.   short         i;
  33.  
  34.   if (! (win->_flags & _SUBWIN))    /* subwindow uses 'parent's' lines */
  35.     {
  36.     for (i = 0; i < win->_maxy && win->_line[i]; i++)
  37.       free(win->_line[i]);
  38.     }
  39.   free(win->_minchng);
  40.   free(win->_maxchng);
  41.   free(win->_line);
  42.   free(win);
  43.   } /* delwin */
  44.